package org.example.dao.category;


import org.apache.ibatis.annotations.*;
import org.example.entity.Category;

import java.util.List;

@Mapper
public interface CategoryMapper {

    @Delete("delete from category where category_id = #{categoryId}")
    boolean delete(Integer categoryId);

    List<Category> listByReason(Integer categoryId, String categoryName, Integer category);


    @Insert("insert into category(category_name, category) VALUES (#{categoryName},#{category})")
    boolean add(Category category) throws Exception;

    @Update("update category set category_name = #{categoryName},category = #{category} where category_id = #{categoryId}")
    void update(Category category);


    @Select("select category.category_name from category")
    List<String> list();

    @Select("select * from category")
    List<Category> allList();
}
